// TextSample.h: interface for the CTextSample class.
//
//////////////////////////////////////////////////////////////////////

#ifndef TEXT_SAMPLE_H
#define TEXT_SAMPLE_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "mcRaster.h"
#include "ASample.h"

class CTextSample : public CASample  
{
public:
	void ClearImage();
	void CalcuAllFeatures();
	CTextSample();
	virtual ~CTextSample();
	void Clear();

	int GetFeatures(vfloat &vfFeatures, vfeaid &vFeaID);

	void SetImages(Raster<uchar>*psrc, McItgImage*pitg,Raster<int>*pvie, Raster<int>*phie);
	//bool LoadImage(const char *strFileName); Jiadi Yang
	void SetRect(irmm_Rect &rect)
	{
		m_rect = rect;
		h = m_rect.Height();
		w = m_rect.Width();
		margin = h/8;
	};

	int CalcuMeanFeatures();
	int CalcuEdgeFeatures();
	int CalcuHistFeatures();
	int CalcuSTDFeatures();
	int GetAllFeatures(vfloat &vfFeatures, vfeaid &vFeaID);
	void CalcuNonEdgeFeatures();

private:
	irmm_Rect m_rect;	// Rectangle of Subwindow
	bool  m_bNew;   // TRUE is below images are new'ed in this class
	Raster<uchar> *m_pimgsrc;	// Source gray image
	McItgImage     *m_pimgitg;	// Source itegral image
	Raster<int>	  *m_pimgvie;	// vertical edge image
	Raster<int>   *m_pimghie;	// horiztonal edge image
	Raster<uchar> *m_pimgdir;	// edge direction image, 8 directions

	vfloat  m_vfMean;
	vfloat  m_vfSTD;
	vfloat  m_vfHist;
	vfloat  m_vfEdge;

	int h,w,margin;
	float m,s;
};

#endif 
